<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>系统登录</title>
		<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
		<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
		<script th:src="@{/js/jquery.min.js}"></script>

	</head>
	<body style="background-color: #92B8B1;">
		<div id="div" style="margin: 0px auto;">
			<div class="layui-container" style="width: 500px;height: 450px;
				">
				<div class="layui-panel" style="width: 100%;height: 100%;border: 1px solid #009688;">
					<div style="text-align: center;font-size: 32pt;height: 55px;padding: 15px;" class="layui-bg-green ">
						登录界面
					</div>
					<div style="margin: 35px 20px;">
						<form class="layui-form layui-form-pane">
							<div class="layui-form-item">
								<label class="layui-form-label" style="height: 50px;padding-top: 15px;">登录名</label>
								<div class="layui-input-block">
									<input style="height: 50px;" class="layui-input" name="loginName" placeholder="输入登录名" autocomplete="off" />
								</div>
							</div>
							<div class="layui-form-item" >
								<label class="layui-form-label" style="height: 50px;padding-top: 15px;">密码</label>
								<div class="layui-input-block">
									<input style="height: 50px;" type="password" class="layui-input" name="password" placeholder="输入密码" autocomplete="off" />
								</div>
							</div>
							<div class="layui-form-item" >
								<div class="layui-inline">
									<label class="layui-form-label" style="height: 50px;padding-top: 15px;">验证码</label>
									<div class="layui-input-inline" style="width: 150px;">
										<input style="height: 50px;" type="text" class="layui-input" name="code" placeholder="验证码(区分大小写)" value="" autocomplete="off" />
									</div>
									<div class="layui-input-inline" style="width: 120px;">
										<a href='#'>
										<!--<img src="img/yzm.jpg" style="height: 50px; width: 120px;" />-->
											<canvas id="canvas" width="100" height="43" top="10" onclick="dj()" style="border: 1px solid #ccc;border-radius: 5px;"></canvas>
										</a>
									</div>
								</div>
								
							</div>
							<div class="layui-form-item" >
								<div class="">
									<a id="loginBtn" class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="loginBtn" onclick="sublim()" style="height: 50px;padding: 5px;font-size: 20px;">
										<i class="layui-icon layui-icon-set"></i>
										登陆
										
									</a>
								</div>
							</div>
						</form>
						<hr>
						<div style="text-align: right;">
							<a th:href="@{/page/forgetPwd}" class="" style="color: #009688;">
							忘记密码......
							</a>
						</div>	
					</div>
				</div>
			</div>	
		</div>
		<script type="text/javascript" th:src="@{/js/code.js}"></script>
		<script>
			var $;
			layui.use(['form','jquery'],function(){
				var form = layui.form;
				$ = layui.jquery;

				getCode();
				$('body').keydown(function (){
					if(event.keyCode == 13){
						$('#loginBtn').click();
					}
				})
				
				$('#div').css({'position':'absolute','top':($(window).height()-450)/2,'left':($(window).width()-500)/2})
		    	$(window).resize(function(){
		    		$('#div').css({'position':'absolute','top':($(window).height()-450)/2,'left':($(window).width()-500)/2})
		    	})


				form.on('submit(loginBtn)',function (data) {
					$('.layui-icon').removeClass('layui-icon-set');
					$('.layui-icon').addClass('layui-icon-loading');
					$('.layui-btn').addClass('layui-disabled');
					var formData = data.field;
					console.log(formData);
					$.ajax({
						type:'post',
						url:'/login/lc/toLogin',
						data:formData,
						dataType:'json',
						success:function (result) {
							if(result.is){
								//window.location.href = '/login/lc/system/index';
								window.location.href = result.url;
							}else{
								$('.layui-btn').removeClass('layui-disabled');
								$('.layui-icon').removeClass('layui-icon-loading');
								$('.layui-icon').addClass('layui-icon-set');
								var msg = result.msg;
								layer.msg(msg);
								//reloadImgCode();
							}
						}
					})
				})
			});

			function getCode() {

				var getCode = [];
				getCode.push(show_num);
				$.ajax({
					type: 'post',
					url:'/login/lc/code',
					data: {
						code:show_num
					},
					dataType: 'json',
					success:function (result) {
						alert("666");
					}
				})
			}


			/*function reloadImgCode() {
				$('#imgCode')[0].src = '${ssm}/imgCode.jsp?'+new Date().getTime().toString();
			}*/


		</script>
	</body>
</html>
